Skip to content

[#352] Add Trading History on reader dashboard with pagination#369

Merged
realproject7 merged 2 commits intomainfrom
task/352-trading-history
Mar 19, 2026
Merged

[#352] Add Trading History on reader dashboard with pagination#369
realproject7 merged 2 commits intomainfrom
task/352-trading-history

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

  • Added user_address column to trade_history table (migration 00019)
  • Updated both trade indexer routes (POST + cron) to save user address from Mint/Burn event user field
  • Added "Trading History" section above Donation History on reader dashboard
  • Each row shows: Buy/Sell label (color-coded), storyline, date, reserve amount, Basescan tx link
  • "Load more" pagination (10 per batch, same pattern as [Feat] Clickable Basescan tx links on donation history + pagination #351)

Note: Migration must be run on Supabase before the Trading History will show data. Existing trade_history rows will have user_address = null until re-indexed.

Fixes #352

Files changed

  • supabase/migrations/00019_trade_history_user_address.sql — new column + index
  • lib/supabase.ts — updated types + added TradeHistory alias
  • src/app/api/index/trade/route.ts — save user_address
  • src/app/api/cron/trade-history/route.ts — save user_address
  • src/app/dashboard/reader/page.tsx — TradingHistory component

Test plan

  • next build passes
  • Lint passes
  • Run migration on Supabase
  • Verify trades appear on reader dashboard after new trades are indexed
  • Verify "Load more" loads additional trades

🤖 Generated with Claude Code

- Add user_address column to trade_history (migration 00019)
- Update trade indexer (POST + cron) to save user address from
  Mint/Burn event args
- Add Trading History section above Donation History on reader
  dashboard with Buy/Sell labels, reserve amount, Basescan tx
  links, and Load more pagination (10 per batch)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: REQUEST CHANGES

Summary

The migration and indexer changes look directionally correct, but the reader-dashboard UI does not yet satisfy the display requirements in issue #352. The new Trading History section is missing both the storyline link/name and the token amount traded for each row.

Findings

  • [medium] Trading History rows omit required storyline navigation and token amount details.
    • File: src/app/dashboard/reader/page.tsx:233
    • Suggestion: extend each row to show the storyline as a clickable link or title, and include the token amount traded alongside the reserve amount. The issue explicitly asks for “Token name/storyline link” and “Amount of tokens traded,” but the current row only renders Story #{t.storyline_id}, date, buy/sell label, reserve amount, and tx link.

Decision

Requesting changes because the UI portion of issue #352 is still incomplete. lint-and-typecheck was also still pending at review time, but the missing fields are the main blocker.

Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Migration adds nullable user_address with proper composite index. Both indexer routes save args.user. reserve_amount is already human-readable (formatUnits at insert time), so formatPrice works correctly. Consistent Load more + tx link patterns. Approved.

Address T2a review: Story #{id} is now a clickable link to the story
page. Token amount (tokens traded) computed from reserve_amount /
price_per_token and displayed alongside the reserve amount.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM on re-review. Story link is now clickable via Next Link, token amount computed with price_per_token > 0 guard to avoid division by zero. Good improvements. Approved.

Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Summary

The updated PR now satisfies the missing UI requirements from issue #352 by adding a clickable story link and a token-amount field to each Trading History row. The migration and indexer changes remain coherent, and the reader-dashboard UI is now complete enough for the requested feature.

Findings

  • No remaining correctness or design issues found in the updated diff.

Decision

Approved on re-review. lint-and-typecheck was still pending again at the time of approval, so merge should still wait for required GitHub checks.

@realproject7 realproject7 merged commit 86b7b01 into main Mar 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] Trading History section on reader dashboard with pagination

2 participants